//package com.lastproject.web.bean;
//
//import javax.ejb.EJB;
//import javax.faces.bean.ManagedProperty;
//import javax.faces.context.ExternalContext;
//import javax.faces.context.FacesContext;
//import javax.servlet.http.HttpServletRequest;
//
//import com.lastproject.dto.ConfidentialEmployeeDTO;
//import com.lastproject.dto.TraineeDTO;
//import com.lastproject.ejb.dao.ConfidentialEmployeeDAORemote;
//import com.lastproject.ejb.dao.TraineeDAORemote;
//
//public class UserToUpdateBean {
//	
//	@EJB
//	ConfidentialEmployeeDAORemote confidentialEmployeeDAORemote;
//	
//	@EJB
//	TraineeDAORemote traineeDAORemote;
//	
//	@ManagedProperty(value = "#{confidentialEmployeeDTO}")
//	private ConfidentialEmployeeDTO confidentialEmployeeDTO;
//
//	@ManagedProperty(value = "#{traineeDTO}")
//	private TraineeDTO traineeDTO;
//	
//	private int selectedTeamLeaderId;
//	private int selectedDepartmentId;
//	private int selectedSuperiorId;
//
//	public ConfidentialEmployeeDTO getConfidentialEmployeeDTO() {
//		return confidentialEmployeeDTO;
//	}
//
//	public void setConfidentialEmployeeDTO(
//			ConfidentialEmployeeDTO confidentialEmployeeDTO) {
//		this.confidentialEmployeeDTO = confidentialEmployeeDTO;
//	}
//
//	public TraineeDTO getTraineeDTO() {
//		return traineeDTO;
//	}
//
//	public void setTraineeDTO(TraineeDTO traineeDTO) {
//		this.traineeDTO = traineeDTO;
//	}
//
//	public int getSelectedTeamLeaderId() {
//		return selectedTeamLeaderId;
//	}
//
//	public void setSelectedTeamLeaderId(int selectedTeamLeaderId) {
//		this.selectedTeamLeaderId = selectedTeamLeaderId;
//	}
//
//	public int getSelectedDepartmentId() {
//		return selectedDepartmentId;
//	}
//
//	public void setSelectedDepartmentId(int selectedDepartmentId) {
//		this.selectedDepartmentId = selectedDepartmentId;
//	}
//
//	public int getSelectedSuperiorId() {
//		return selectedSuperiorId;
//	}
//
//	public void setSelectedSuperiorId(int selectedSuperiorId) {
//		this.selectedSuperiorId = selectedSuperiorId;
//	}
//
//	public String initUpdateSelector() {
//
//		FacesContext ctx = FacesContext.getCurrentInstance();
//		ExternalContext ectx = ctx.getExternalContext();
//		HttpServletRequest request = (HttpServletRequest) ectx.getRequest();
//
//		int id = Integer.parseInt(request.getParameter("updateId"));
////		id = Integer.parseInt(request.getParameter("updateId"));
//		String type = request.getParameter("updateType");
//
//		System.out.println("idforupdate = " + id);
//		System.out.println("typeforupdate = " + type);
//
//		String returnPage = "";
//
//		switch (type) {
//
//		case "ConfidentialEmployee":
//
//			System.out.println("case confidentialemployee");
//			ConfidentialEmployeeDTO c = confidentialEmployeeDAORemote
//					.findById(id);
//
//			confidentialEmployeeDTO.setFirstname(c.getFirstname());
//			confidentialEmployeeDTO.setLastname(c.getLastname());
//			confidentialEmployeeDTO.setUsername(c.getUsername());
//			confidentialEmployeeDTO.setWorkEmail(c.getWorkEmail());
//			confidentialEmployeeDTO.setDob(c.getDob());
//			confidentialEmployeeDTO.setPersonalPhone(c.getPersonalPhone());
//			confidentialEmployeeDTO.setPersonalEmail(c.getPersonalEmail());
//			confidentialEmployeeDTO.setEmploymentDate(c.getEmploymentDate());
//			confidentialEmployeeDTO.setMedCheckUpDate(c.getMedCheckUpDate());
//			confidentialEmployeeDTO.setEmploymentType(c.getEmploymentType());
//			confidentialEmployeeDTO.setPosition(c.getPosition());
//			// confidentialEmployeeDTO.setCv(cv);
//			confidentialEmployeeDTO.setProsisNr(c.getProsisNr());
//			confidentialEmployeeDTO.setWorkPhone(c.getWorkPhone());
//			confidentialEmployeeDTO.setGermanContactPerson(c
//					.getGermanContactPerson());
//			confidentialEmployeeDTO.setCareerLevel(c.getCareerLevel());
//
//			selectedTeamLeaderId = c.getIdTeamLeader();
//			selectedDepartmentId = c.getIdDepartment();
//			selectedSuperiorId = c.getIdSuperior();
//			
////			roleIdList = confidentialEmployeeDTO.getRolesIdList();
////			System.out.println("in employee bean, roleIdList " + roleIdList);
////			
////			if(!roleIdList.equals(Collections.<Object>emptyList())) {
////				for(int i=0; i<roleIdList.size(); i++) {
////					System.out.println("Roles ids " + roleIdList.get(i));
////				}
////			} else {
////				System.out.println("No fucking roles here");
////			}
//
//			returnPage = "addEmployee";
//			break;
//
//		case "Trainee":
//
//			TraineeDTO t = traineeDAORemote.findById(id);
//			
//			traineeDTO.setFirstname(t.getFirstname());
//			traineeDTO.setLastname(t.getLastname());
//			traineeDTO.setUsername(t.getUsername());
//			traineeDTO.setWorkEmail(t.getWorkEmail());
//			traineeDTO.setDob(t.getDob());
//			traineeDTO.setPersonalPhone(t.getPersonalPhone());
//			traineeDTO.setPersonalEmail(t.getPersonalEmail());
//			traineeDTO.setEmploymentDate(t.getEmploymentDate());
//			traineeDTO.setMedCheckUpDate(t.getMedCheckUpDate());
//			traineeDTO.setEmploymentType(t.getEmploymentType());
//			traineeDTO.setPosition(t.getPosition());
//			// traineeDTO.setCv(cv);
//			traineeDTO.setSalary(t.getSalary());
//			
//			returnPage = "addTrainee";
//			break;
//
//		}
//		return returnPage;
//	}
//
//}
